const mongoose = require('mongoose');

const parkingSchema = new mongoose.Schema({
  spotNumber: {
    type: String,
    required: true,
    unique: true
  },
  zone: {
    type: String,
    required: true,
    enum: ['A', 'B', 'C', 'D']
  },
  floor: {
    type: Number,
    required: true
  },
  status: {
    type: String,
    enum: ['available', 'occupied', 'reserved', 'maintenance'],
    default: 'available'
  },
  coordinates: {
    x: Number,
    y: Number
  },
  hourlyRate: {
    type: Number,
    default: 5
  },
  isVIP: {
    type: Boolean,
    default: false
  },
  vehicleInfo: {
    plateNumber: String,
    vehicleType: String,
    ownerName: String,
    checkInTime: Date,
    checkOutTime: Date,
    estimatedCheckOut: Date,
    reservationTime: Date
  }
}, {
  timestamps: true
});

module.exports = mongoose.model('Parking', parkingSchema);
